package com.zbkj.service.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zbkj.common.model.shop.InvitationCodeEntity;
import com.zbkj.service.dao.shop.InvitationCodeDao;
import com.zbkj.service.service.InvitationCodeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class InvitationCodeServiceImpl extends ServiceImpl<InvitationCodeDao, InvitationCodeEntity> implements InvitationCodeService {
    @Override
    @DS("pointarchive")
    public InvitationCodeEntity getDevelopAdApply(InvitationCodeEntity invitationCodeEntity) {
        return this.getOne(new LambdaQueryWrapper<InvitationCodeEntity>()
                .eq(invitationCodeEntity.getXuanPinInvitationCode()!=null,InvitationCodeEntity::getXuanPinInvitationCode, invitationCodeEntity.getXuanPinInvitationCode())
                .eq(invitationCodeEntity.getAgentInvitationCode()!=null,InvitationCodeEntity::getAgentInvitationCode, invitationCodeEntity.getAgentInvitationCode())
                .last(" limit 1")
        );
    }
}
